const { SyncLoopHook } = require('tapable')
let hook = new SyncLoopHook(['name', 'age'])
let count1 = 0
let count2 = 0
let count3 = 0


// fn1只是作为标记使用
hook.tap('fn1', (name, age) => {
    console.log('fn1--->',name, age);
    if(++count1 === 1) {
        count1 = 0
        return undefined
    }
    return true
})

hook.tap('fn2', (name, age) => {
    console.log('fn2--->',name, age);
    // if(++count2 === 2) {
    //     count2 = 0
    //     return undefined
    // }
    // return true
})

hook.tap('fn3', (name, age) => {
    console.log('fn3--->',name, age);
    // if(++count3 === 3) {
    //     count3 = 0
    //     return undefined
    // }
    // return true
})

hook.call('fffff', 900)



// SyncLoopHook


